﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;

namespace LAPI.Core.Logging
{
    public class DefaultLoggerFactory : ILoggerFactory
    {        
        public DefaultLoggerFactory(string cfgFile){
            ConfigureLogger(cfgFile);
        }

        public ILogger CreateLogger(Type type) {
            return new DefaultLogger(LogManager.GetLogger(type));
        }

        public ILogger CreateLogger(string name) {
            return new DefaultLogger(LogManager.GetLogger(name));
        }

        protected void ConfigureLogger(string configFile)
        {
            XmlConfigurator.Configure(new System.IO.FileInfo(configFile));
        }
    }
}
